
import React from 'react';
import './index.less';
import goBackIcon from './../../assets/icon/goback.png';

class CardTitle extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            status: 'browse'
        };
        this.output = {
            setButtonState: this.setButtonState
        }
    }
    componentDidMount() {

    }

    componentWillUnmount() {


    }

    backRoute = () => {
        let { backRoute } = this.props;
        if (typeof backRoute === 'string') {
            window.location.href = `./${backRoute}.html`;
        }
        if (typeof backRoute === 'object') {
            this.props.router.push(backRoute);
        }
        if (typeof backRoute === 'function') {
            backRoute();
        }
    }

    render() {
        let { title, billIcon, pageStatus } = this.props;

        return (
            <div className="ygc-card-header-title">
                <div className="ygc-card-header-title-back">
                    {/* {pageStatus === 'browse' ? <img src={goBackIcon} onClick={this.backRoute}/> : null} */}
                    <img src={goBackIcon} onClick={this.backRoute}/>
                </div>
                <div className="ygc-card-header-title-icon">
                    <img src={billIcon} />
                </div>
                <div className="ygc-card-header-title-word">{title}</div>
            </div>
        )
    }
    setButtonState = (status) => {
        this.setState({
            status
        })
    }
}



export default function YGCreateCardTitle(params) {
    return (
        <CardTitle {...params} />
    )
}